<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        #data {
            width: 405px;
            height: 300px;
            background-color: rgb(231, 116, 63);
            border-radius: 10px;
            margin: 100px auto;
        }
        #newData {
            width: 450px;
            height: 60px;
            line-height: 60px;
            text-align: center;
            color: #fff;
            font-size: 22px;
        }
        #day {
            width: 200px;
            height: 200px;
            background-color: blueviolet; 
            line-height: 200px;    
            margin: 0 auto;
            text-align: center;
            color: #fff;
            font-weight: bold;
            font-size: 60px;
        }
    </style>
</head>
<body>
    <div id="data">
            <p id="newData"></p>
            </p>
        <div id="day">
        </div>
    </div>
    <script>
        var newDate=document.getElementById('newData');
        var days=document.getElementById('day');
        setInterval(nowNumTime,1000);
        function nowNumTime(){
            var now=new Date();
            var hour=now.getHours();
            var minute=now.getMinutes();
            var second=now.getSeconds();
            var day=now.getDate();
            var week=now.getDay();
            var month=now.getMonth();
            month=month+1;
            var year=now.getFullYear();
            var temp=''+(hour>12?hour-12:hour);
            var weeks=["星期一","星期二","星期三","星期四","星期五","星期六","星期日"];
            if(hour===0){
                temp='12';
            }
            temp=temp+(minute<10?':0':":")+minute;
            temp=temp+(second<10?':0':":")+second;
            temp=temp+(hour>=12?'P.M':"A.M ");
            temp=temp+(' '+year+'年'+month+'月'+day+'日'+weeks[week]);
            days.innerHTML=day;
            newDate.innerHTML=temp;
        }
        

    </script>
</body>
</html>